<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery/jquery1.9/jquery-1.9.0.js"></script>
    <script>
        $(function(){
            $("input:eq(0)").click(function(){
                console.log($("div:visible").length);
                $("div:visible").css("background","red");
            });
            $("input:eq(1)").click(function(){
                console.log($("div:hidden").length);
            });
            $("input:eq(2)").click(function(){
                //:hidden包含：
                    // 1.display为none
                    // 2.宽高为0
                    // 3.隐藏域type="hidden"
                    // 4.父容器为隐藏的，那么子元素被认为是隐藏的
                console.log($("body :hidden").length);
               
            });
           
        });
    </script>
</head>
<body>
    <input type="button" value="选择所有可见的div">
    <input type="button" value="选择所有隐藏的div">
    <input type="button" value="选择所有隐藏的元素">
    <hr>
    <div>可见的div1</div>
    <div>可见的div2</div>
    <div style="display:none;">不可见的div</div>
    <div style="width:0;height:0;"></div>
    <input type="hidden">
    <div style="display:none;">
        <span>heihei</span>
    </div>
</body>
</html>